package com.itheima.inner.practice01;

public class Test02 {
    public static void main(String[] args) {
        goSwimming(new Swimming() {
            @Override
            public void swim() {
                System.out.println("去游泳");
            }
        });

    }


    public static void goSwimming(Swimming swimming){
        /* 多态 父类的引用指向子类对象
         Swimming swim =new Swimming() {
            @Override
            public void swim() {
                System.out.println("去游泳");
            }
        }
         */
        swimming.swim();
    }


}
interface Swimming{
    void swim();
}